<?php
namespace Home\Controller;
use Think\Controller;
class IndexController extends Controller {
    public function index(){
      // 调用第三方库
      // $user = new \Home\Tool\AddTool();
      // echo $user->user();
      // exit;
    	$cat = D("Admin/Cat");
    	$tree = $cat->gettree();
    	$this->assign("cattree",$tree);
    	//热销商品
    	$goods = D("Admin/Goods");
    	$hot = $goods->field('goods_id,goods_name,shop_price,goods_img,market_price')->order("goods_id DESC")->where('is_hot=1')->limit(4)->select();
       $this->assign('hot',$hot);
       //精品推荐
       $best = $goods->field('goods_id,goods_name,shop_price,goods_img,market_price')->order("goods_id DESC")->where('is_best=1')->limit(4)->select();
       $this->assign('best',$best);
       //新品
        $new = $goods->field('goods_id,goods_name,shop_price,goods_img,market_price')->order("goods_id DESC")->where('is_new=1')->limit(4)->select();
       $hisotry = array_reverse(session("hisotry"),true);
       $this->assign("host",$hisotry);
       $this->assign('new',$new);
       $this->display();
    }
}